"""
URL configuration for user_management_system project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

# from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from users import views

"""
DefaultRouter 是 DRF 提供的一个高级路由类，用于自动生成 URL 配置，支持标准的 RESTful 接口风格。它会为视图集（ViewSet）自动创建以下路由：
HTTP 方法             URL 路径                   对应操作                            说明
GET               /api/departments/              list()                       获取所有部门（列表）
POST              /api/departments/              create()                     创建新部门
GET               /api/departments/{id}/         retrieve()                   获取单个部门详情
PUT               /api/departments/{id}/         update()                     全字段更新部门
PATCH             /api/departments/{id}/         partial_update()             部分字段更新部门
DELETE            /api/departments/{id}/          destroy()                    删除部门
同理，/api/users/ 也会生成类似的路由。

"""
router = DefaultRouter()
router.register(r'departments', views.DepartmentViewSet)
router.register(r'employees',views.EmployeeViewSet)

urlpatterns = [
    #    path("admin/", admin.site.urls),
    path('api/',include(router.urls)),
]
